﻿
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- saved from url=(0014)about:internet -->
<html xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:mssdk="winsdk" xmlns:script="urn:script" xmlns:build="urn:build" xmlns:MSHelp="http://msdn.microsoft.com/mshelp">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="Description" content="PLMDebug.exe is a tool that enables you to use the Windows debugger to debug Windows app, which run under Process Lifecycle Management (PLM). With PLMDebug, you can take manual control of suspending, resuming, and terminating a Windows app."/>
<meta name="MSHAttr" content="PreferredSiteName:MSDN"/>
<meta name="MSHAttr" content="PreferredLib:/library/windows/hardware"/>
<title>PLMDebug</title>



<link rel="STYLESHEET" type="text/css" HREF="../common/backsdk4.css"/>





<style>
html,div { margin: 0; padding: 0;}

body {
	padding: 0px;
	margin: 0px;
	overflow: auto;
	height: 100%;
}

#winchm_template_button{
	float: right;
	width: 93px;
	top: 7px;
	position: relative;
	text-align: right;
	right: 5px;
	height: auto;
}

#winchm_template_top{
	padding: 0px;
	margin: 0px;
	border-bottom: 1px solid #9B9B9B;
	background-color: #B1CEFE;
}

#winchm_template_navigation{
	margin: 0px;
	padding-top: 7px;
	padding-left: 7px;
	padding-bottom: 3px;
	padding-right: 0px;
	font-size: 8.5pt;
	font-family: Arial, Helvetica, sans-serif;
	font-weight: normal;
	color: #585858;
}

#winchm_template_title{
	margin: 0px;
	padding-top: 4px;
	padding-left: 7px;
	padding-bottom: 7px;
	padding-right: 0px;
	font-size: 18px; 
	font-family: Verdana, Geneva, sans-serif;
	color: #363636;
}

#winchm_template_content{
	margin-top: 20px;
	margin-left: 15px;
	margin-bottom: 20px;
	margin-right: 15px;
	width: auto  !important;
	width: 100%;
}

#winchm_template_footer{
	border-width: 1px;
	border-color: #B1CEFE;
	border-top-style: solid;
	margin-top: 15px;
	margin-left: 15px;
	margin-bottom: 20px;
	margin-right: 15px;
	padding-top: 7px;
	padding-left: 0px;
	padding-bottom: 0px;
	padding-right: 0px;
	font-family: arial, helvetica, sans-serif;
	font-size: 8.5pt;
	color: #696969;
	width: auto;
	text-align: left;
}


#winchm_template_container{
	margin: 0px;
	padding: 0px;
	position: static;
	padding-bottom: 3px;
	overflow: auto;
	background-color: #FFFFFF;
}


@media print
{
#winchm_template_container{
	position: static;	
	margin: 0px;
	padding: 5px;
	
	width: auto;
	height: auto;
	overflow: auto;
}
#winchm_template_button{
visibility:hidden;
}
}

#winchm_template_navigation A:link	{text-decoration: none; color:#004080}
#winchm_template_navigation A:visited  {text-decoration: none; color: #004080}
#winchm_template_navigation A:active {text-decoration: none; color: #004080 }
#winchm_template_navigation A:hover {text-decoration: none;color: #0080FF}

A:link	{text-decoration: underline; color:#0033CC}
A:visited  {text-decoration: underline; color: #0033CC}
A:active {text-decoration: underline; color: #0033CC }
A:hover {text-decoration: underline;color: #FF0000;}
</style>
<script type="text/javascript">
function isMobile(){
Agent = window.navigator.userAgent;
if (Agent.indexOf("iPhone")>=1 || Agent.indexOf("iPad")>=1 || Agent.indexOf("iPod")>=1 || Agent.indexOf("Android")>=1){
return true;
}else{
return false;	
}

}
function d_onresize(){
if (window.navigator.userAgent.indexOf("MSIE")>=1){
document.getElementById('winchm_template_container').style.pixelWidth = document.body.offsetWidth - 3;
document.getElementById('winchm_template_container').style.pixelHeight = document.body.offsetHeight - document.getElementById('winchm_template_top').offsetHeight - 4;
}
document.getElementById('winchm_template_container').style.top = document.getElementById('winchm_template_top').offsetHeight + 'px';
}

function d_onbeforeprint(){
document.getElementById('winchm_template_container').style.width = 'auto';
document.getElementById('winchm_template_container').style.height = 'auto';
}

function d_onafterprint(){
d_onresize();
}

if(!isMobile()){

window.onload = d_onresize;
window.onresize = d_onresize;
window.onbeforeprint = d_onbeforeprint;
window.onafterprint = d_onafterprint;

document.write("<style>\n");
document.write("body {overflow: hidden;}\n");
document.write("#winchm_template_container {position: absolute;overflow: auto;top : 0px;right: 0px;bottom: 0px;left: 0px;}\n");
document.write("</style>\n");
}

</script>
</head>
<body><script language="JavaScript" type="text/JavaScript">
function syn(){
if(parent.nav.tree){
 if(parent.nav.tree.loaded){
  parent.nav.tree.selectNode(123);
 }else{
  setTimeout("syn()",500);
}
  }else{
  setTimeout("syn()",500);
  }}
if(parent!=self){
  setTimeout("syn()",100);
}else{
  parent.location.href = "../../index.htm?page=debugger/plmdebug.htm";
}
originalOnload = window.onload;
if(originalOnload==null){
window.onload = function(){parent.contentLoaded = true;};
}else{
window.onload = function(){originalOnload();parent.contentLoaded = true;};
}
</script> 


<div id="winchm_template_top">
	<div id="winchm_template_button"><A href="manifest_file_format.htm" title="Previous topic"><img id="winchm_template_prev" alt="Previous topic" src="../template2/btn_prev_n.gif" border="0"></a><A href="remote_tool.htm" title="Next topic"><img id="winchm_template_next" alt="Next topic" src="../template2/btn_next_n.gif" border="0"></a></div>
	<div id="winchm_template_navigation">Help &gt; 
<A href="introduction6.htm">Debugging Tools for Windows (WinDbg, KD, CDB, NTSD)</A> &gt; <A href="debugging_resources.htm">Debugging Resources</A> &gt; <A href="extra_tools.htm">Tools Included in Debugging Tools for Windows</A> &gt; </div>
	<div id="winchm_template_title">PLMDebug</div>
</div>
<div id="winchm_template_container">
	<div id="winchm_template_content"><div id="mainSection"><p>PLMDebug.exe is a tool that enables you to use the Windows debugger to debug Windows app, which run under Process Lifecycle Management (PLM). With PLMDebug, you can take manual control of suspending, resuming, and terminating a Windows app.</p>
<div class="alert"><b>Tip</b>  With Windows 10, version 1607 or later, you can use the UWP commands, such as .createpackageapp to debug UWP apps. For more information see <a href="#Bookmark1217">Debugging a UWP app using WinDbg</a>.</div>
<div> </div>
<p><b>Where to get PLMDebug</b></p>
<p>PLMDebug.exe is included in <a href="#Bookmark0">Debugging Tools for Windows</a>.</p>
<pre class="syntax"><b>plmdebug </b><b>/query</b> [<i>Package</i>]
<b>plmdebug </b><b>/enableDebug</b> <i>Package</i> [<i>DebuggerCommandLine</i>]
<b>plmdebug /terminate </b><i>Package</i>
<b>plmdebug /forceterminate </b><i>Package</i>
<b>plmdebug /cleanterminate </b><i>Package</i>
<b>plmdebug /suspend </b><i>Package</i>
<b>plmdebug /resume </b><i>Package</i>
<b>plmdebug /disableDebug </b><i>Package</i>
<b>plmdebug /enumerateBgTasks </b><i>Package</i>
<b>plmdebug /activateBgTask</b><i>TaskId</i>
</pre>
<h2><a id="Parameters"></a><a id="parameters"></a><a id="PARAMETERS"></a>Parameters</h2>
<p></p>
<dl>
<dt><a id="_______Package"></a><a id="_______package"></a><a id="_______PACKAGE"></a>       <i>Package</i></dt>
<dd>
<p>The full name of a package or the ID of a running process.</p>
</dd>
<dt><a id="_______DebuggerCommandLine"></a><a id="_______debuggercommandline"></a><a id="_______DEBUGGERCOMMANDLINE"></a>       <i>DebuggerCommandLine</i></dt>
<dd>
<p>A command line to open a debugger. The command line must include the full path to the debugger. If the path has blank spaces, it must be enclosed in quotes. The command line can also include arguments. Here are some examples:</p>
<p><code>"C:\Program Files (x86)\Windows Kits\8.0\Debuggers\x64\WinDbg.exe"</code></p>
<p><code>"\"C:\Program Files\Debugging Tools for Windows (x64)\WinDbg.exe\" -server npipe:pipe=test"</code></p>
</dd>
<dt><a id="________query_Package"></a><a id="________query_package"></a><a id="________QUERY_PACKAGE"></a>       <b>/query</b> [<i>Package</i>]</dt>
<dd>
<p>Displays the running state for an installed package. If <i>Package</i> is not specified, this command displays the running states for all installed packages.</p>
</dd>
<dt><a id="________enableDebug_Package_DebuggerCommandLine"></a><a id="________enabledebug_package_debuggercommandline"></a><a id="________ENABLEDEBUG_PACKAGE_DEBUGGERCOMMANDLINE"></a>       <b>/enableDebug</b> <i>Package</i> [<i>DebuggerCommandLine</i>]</dt>
<dd>
<p>Increments the debug reference count for a package. The package is exempt from PLM policy if it has a non-zero debug reference count. Each call to <b>/enableDebug</b> must be paired with a call to /<b>disableDebug</b>. If you specify <i>DebuggerCommandLine</i>, the debugger will attach when any app from the package is launched.</p>
</dd>
<dt><a id="________terminate_Package"></a><a id="________terminate_package"></a><a id="________TERMINATE_PACKAGE"></a>       <b>/terminate </b><i>Package</i></dt>
<dd>
<p>Terminates a package.</p>
</dd>
<dt><a id="________forceTerminate_Package"></a><a id="________forceterminate_package"></a><a id="________FORCETERMINATE_PACKAGE"></a>       <b>/forceTerminate </b><i>Package</i></dt>
<dd>
<p>Forces termination of a package.</p>
</dd>
<dt><a id="________cleanTerminate_Package"></a><a id="________cleanterminate_package"></a><a id="________CLEANTERMINATE_PACKAGE"></a>       <b>/cleanTerminate </b><i>Package</i></dt>
<dd>
<p>Suspends and then terminates a package.</p>
</dd>
<dt><a id="________suspend_Package"></a><a id="________suspend_package"></a><a id="________SUSPEND_PACKAGE"></a>       <b>/suspend </b><i>Package</i></dt>
<dd>
<p>Suspends a package.</p>
</dd>
<dt><a id="________resume_Package"></a><a id="________resume_package"></a><a id="________RESUME_PACKAGE"></a>       <b>/resume </b><i>Package</i></dt>
<dd>
<p>Resumes a package.</p>
</dd>
<dt><a id="________disableDebug_Package"></a><a id="________disabledebug_package"></a><a id="________DISABLEDEBUG_PACKAGE"></a>       <b>/disableDebug </b><i>Package</i></dt>
<dd>
<p>Decrements the debug reference count for a package.</p>
</dd>
<dt><a id="________enumerateBgTasksPackage"></a><a id="________enumeratebgtaskspackage"></a><a id="________ENUMERATEBGTASKSPACKAGE"></a>       <b>/enumerateBgTasks</b><i>Package</i></dt>
<dd>
<p>Enumerate background task ids for a package.</p>
</dd>
<dt><a id="________activateBgTaskTaskId"></a><a id="________activatebgtasktaskid"></a><a id="________ACTIVATEBGTASKTASKID"></a>       <b>/activateBgTask</b><i>TaskId</i></dt>
<dd>
<p>Activates a background task. Note that not all background tasks can be activated using  PLMDebug.</p>
</dd>
</dl>
<h2>Remarks</h2>
<p>You must call <b>plmdebug /enableDebug</b> before you call any of the suspend, resume, or terminate functions.</p>
<p>The PLMDebug tool calls the methods of the <a href="http://go.microsoft.com/fwlink/p/?LinkID=267918">IPackageDebugSettings interface</a>. This interface enables you to take manual control of the process lifecycle management for your apps. Through this interface (and as a result, through this tool), you can suspend, resume, and terminate your Windows app. Note that the  methods of the <a href="http://go.microsoft.com/fwlink/p/?LinkID=267918">IPackageDebugSettings interface</a> apply to an entire package. Suspend, resume, and terminate affect all currently running apps in the package.</p>
<h2>Examples</h2>
<p><b>Example 1</b></p>
<p><b>Attach a debugger when your app is launched</b></p>
<p>Suppose you have an app named MyApp that is in a package named MyApp_1.0.0.0_x64__tnq5r49etfg3c. Verify that your package is installed by displaying the full names and running states all installed packages. In a Command Prompt window, enter the following command.</p>
<p><b>plmdebug /query</b></p>
<pre class="syntax" xml:space="preserve"><code>Package full name: 1daa103b-74e1-426d-8193-b6bc7ed66fed_1.0.0.0_x86__tnq5r49etfg3c
Package state: Terminated

Package full name: 41fb5f27-7b60-4f5e-8459-803673131dd9_1.0.0.0_x86__tnq5r49etfg3c
Package state: Suspended
...
Package full name: MyApp_1.0.0.0_x64__tnq5r49etfg3c
Package state: Terminated
...</code></pre>
<p>Increment the debug reference count for your package, and specify that you want WinDbg to attach when your app is launched.</p>
<p><b>plmdebug /enableDebug MyApp_1.0.0.0_x64__tnq5r49etfg3c "C:\Program Files (x86)\Windows Kits\8.0\Debuggers\x64\WinDbg.exe"</b></p>
<p>When you launch your app, WinDbg will attach and break in.</p>
<p>When you have finished debugging, detach the debugger. Then decrement the debug reference count for your package.</p>
<p><b>plmdebug /disableDebug MyApp_1.0.0.0_x64__tnq5r49etfg3c </b></p>
<p><b>Example 2</b></p>
<p><b>Attach a debugger to an app that is already running</b></p>
<p>Suppose you want to attach WinDbg to MyApp, which is already running. In WinDbg, on the <b>File</b> menu, choose <b>Attach to a Process</b>. Note the process ID for MyApp. Let's say the process ID is 4816.</p>
<p>Increment the debug reference count for the package that contains MyApp.</p>
<p><b>plmdebug /enableDebug 4816</b></p>
<p>In WinDbg, in the <b>Attach to Process</b> dialog box, select process 4816, and click <b>OK</b>. WinDbg will attach to MyApp.</p>
<p>When you have finished debugging MyApp, detach the debugger. Then decrement the debug reference count for the package.</p>
<p><b>plmdebug /disableDebug 4816</b></p>
<div class="code"></div>
<p><b>Example 3</b></p>
<p><b>Manually suspend and resume your app</b></p>
<p>Suppose you want to manually suspend and resume your app. First, increment the debug reference count for the package that contains your app.</p>
<p><b>plmdebug /enableDebug MyApp_1.0.0.0_x64__tnq5r49etfg3c</b></p>
<p>Suspend the package. Your app's suspend handler is called, which can be helpful for debugging.</p>
<p><b>plmdebug /suspend MyApp_1.0.0.0_x64__tnq5r49etfg3c</b></p>
<p>When you have finished debugging, resume the package.</p>
<p><b>plmdebug /resume MyApp_1.0.0.0_x64__tnq5r49etfg3c</b></p>
<p>Finally, decrement the debug reference count for the package.</p>
<p><b>plmdebug /disableDebug MyApp_1.0.0.0_x64__tnq5r49etfg3c</b></p>
<div class="code"></div>
<h2><a id="see_also"></a>See also</h2>
<dl>
<dt><a href="http://go.microsoft.com/fwlink/p/?LinkID=267916">How to trigger suspend, resume, and background events in Windows Apps</a></dt>
<dt><a href="#Bookmark33">Tools Included in Debugging Tools for Windows</a></dt></dl></div></div>	
	<div id="winchm_template_footer">Copyright &copy; 2019. All rights 
reserved. (To change the copyright info, just edit it in template.)</div>
</div>

</body>
</html>
